# !/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
===========================
@Time : 2022/7/10 0010 15:04
@Author : 测试开发工程师
@File : wework.py
@Software: PyCharm
============================
"""

from apitest.Test_frame.apis.base_api import BaseApi


class WeWork(BaseApi):

    def __init__(self):
        self.access_token = None

    def get_token(self, corpid, secret):
        """
        获取 token
        """
        params = {"corpid": corpid,
                  "corpsecret": secret}
        token_url = "/gettoken"
        req = {
            "method": "GET",
            "url": token_url,
            "params": params
        }
        r = self.send_api(req)
        self.access_token = r.json().get("access_token")
